// Using jQuery with Other Libraries
try {
jQuery.noConflict();

// Blogger extensions Options
var BloggerExtOptions = {
    core_version: '0.6.2b'
};

var BloggerExt = {};
jQuery.extend( BloggerExt, {
        extensions: [],
        hooks: [],

        register: function(flag, opts) {
            BloggerExt.extensions.push(flag);
            if(opts) { jQuery.extend(BloggerExtOptions, opts); }
        },
        
        registerHook: function (fn) {
            BloggerExt.hooks.push(fn);
        },

        process: function() {
            jQuery(document).ready( function(){
                var flag;
                while( flag = BloggerExt.extensions.pop() ) {
                    if(BloggerExtOptions[flag]) { try { BloggerExt[flag](); }catch(e){} }
                }
                // run hooks
                BloggerExt.processHook();
            });
        },

        processHook: function() {
            // Try hook Blogger _WidgetManager_HandleControllerResult
            if(BloggerExt.isListMode() && (typeof BloggerExt._WidgetManager_HandleControllerResult == 'undefined') ) {
                BloggerExt._WidgetManager_HandleControllerResult = _WidgetManager._HandleControllerResult;
                _WidgetManager._HandleControllerResult = function() {
                    try {
                        // Call _WidgetManager_HandleControllerResult
                        BloggerExt._WidgetManager_HandleControllerResult.apply(this, arguments);
                        // call register hooks
                        while (fn = BloggerExt.hooks.pop()) { fn.call(this); }
                    }catch(e) {
                    }
                }
            }
        },

        registerAndProcess: function(flag, opts) {
            BloggerExt.register(flag,opts);
            BloggerExt.process();
        },

        isListMode: function() {
            var isList = false;
            if ( document.location.href.split('/').pop() == "" || document.location.href.split('/').pop() == "index.html") {
                // Suppose the url include index.html
                isList = true;
            }else if(document.location.href.indexOf("/search/label/") >= 0) {
                // Suppose the url search label  
                isList = true;
            }else if((document.location.href.indexOf("/search?") >= 0) || (document.location.href.indexOf("archive.html") >= 0)) {
                // Suppose the url include search or archive
                isList = true;
            }
            return isList;
        },

        isItemMode: function() {
            return (!BloggerExt.isListMode());
        }
});

// Register hide_navbar
BloggerExt.hide_navbar = function() {
    if(BloggerExtOptions.fade_navbar) {
        jQuery('#navbar').fadeTo(0,0).hover( function() { $(this).fadeTo("fast", 1); }, function() { $(this).fadeTo("fast", 0); }); 
    }else {
        jQuery('#navbar').hide();
    }
};
BloggerExt.register('hide_navbar', { hide_navbar: true, fade_navbar: false} );


// Register hide_sidebar_html_markup
BloggerExt.hide_sidebar_html_markup = function() {
    jQuery('.HTML').each( function(i) {
            jQuery('.title', this).contains('##HIDEME##').each( function(){ jQuery(this).hide(); } );
    });
};
BloggerExt.register('hide_sidebar_html_markup', { hide_sidebar_html_markup: true} );


// Run All Register Process
BloggerExt.process();
}catch (e) { }

